﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Jzy.Workflow.Node;

namespace Jzy.Workflow.Line
{
    public partial class FlowLineInfo
    {
        public FlowLineInfo() 
        {
            GetNodeInfo = id => null;
        }


        private FlowNodeInfo _fromNode, _toNode;
        public Func<object, FlowNodeInfo> GetNodeInfo;
        public FlowNodeInfo FromNode
        {
            get
            {
                if (_fromNode == null)
                {
                    _fromNode = GetNodeInfo(FromNodeID);
                }
                return _fromNode;
            }
            set
            {
                _fromNode = value;
            }
        }

        public FlowNodeInfo ToNode
        {
            get
            {
                if (_toNode == null)
                {
                    _toNode = GetNodeInfo(ToNodeID);
                }
                return _toNode;
            }
            set
            {
                _toNode = value;
            }
        }

    }
}
